public class DialogNoLivesWildcard : GenericDialog
{
	public int levelNumber;

	private bool hideInGameDarkenOnDisable = true;

	private void OnEnable()
	{
		if (Globals.appState != 0 && Globals.appState != AppState.unknown)
		{
			hideInGameDarkenOnDisable = true;
			if (Globals.appState == AppState.game)
			{
				UserInterface.GetInstance().ShowInGameDarken(CloseDialog, 0f);
				CustomAnalytics.LogUIEvent("Game", "Zero Lives Wildcard");
			}
			GenericDialog.FireDialogEnabledEvent();
		}
	}

	private void OnDisable()
	{
		if (Globals.appState != 0 && Globals.appState != AppState.unknown && hideInGameDarkenOnDisable)
		{
			UserInterface.GetInstance().HideInGameDarken();
		}
	}

	public void CloseDialog()
	{
		if (Globals.appState == AppState.game && Game.currentGameMode == GameMode.Normal)
		{
			hideInGameDarkenOnDisable = false;
			CustomAnalytics.LogUIEvent("Game", "Zero Lives Wildcard - No");
			FadeOut();
			UserInterface.GetInstance().dialogNoLives.FadeIn();
		}
		else if (Globals.appState == AppState.menu)
		{
			UserInterface.GetInstance().CloseModalDialog();
		}
	}

	public void OnButtonAccept()
	{
		Audio.PlaySoundButton();
		if (Economy.hasInstance)
		{
			Economy.ConsumeWildcard();
		}
		if (Globals.appState == AppState.game)
		{
			CustomAnalytics.LogUIEvent("Game", "Zero Lives Wildcard - Yes");
			Game.currentGameMode = GameMode.NormalWildcard;
			UserInterface.GetInstance().displayWildcardGame.gameObject.SetActive(true);
			UserInterface.GetInstance().FinishRespawn();
			FadeOut();
		}
		else if (Globals.appState == AppState.menu)
		{
			CustomAnalytics.LogUIEvent("Menu", "Play - Zero Lives Confirm");
			UserInterface.GetInstance().CloseModalDialog(false);
			UserInterface.GetInstance().StartLevel(levelNumber, GameMode.NormalWildcard);
		}
	}
}
